package com.ytjj.qmyx.mall.utils;

import com.ytjj.common.utils.TokenUtil;
import com.ytjj.qmyx.mall.mapper.AdvertReportMapper;
import com.ytjj.qmyx.mall.model.AdvertReport;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

@Component
public class AdvertReportUtil {

    @Resource
    private AdvertReportMapper advertReportMapper;

    public void saveAdverReport(String type,Integer productId,String advertPlatform){
        AdvertReport advertReport = new AdvertReport();
        advertReport.setCallback(TokenUtil.getRequest().getHeader("callback"));
        advertReport.setChannel(TokenUtil.getChannel());
        advertReport.setToken(TokenUtil.getToken());
        advertReport.setType(type);
        advertReport.setProductId(productId);
        advertReport.setStatus(0);
        advertReport.setAdvertPlatform(advertPlatform);
        advertReport.setCreateTime(new Date());
        advertReportMapper.insert(advertReport);
    }
}
